﻿var portalEnginer = null;
var gameEffect = null;
var gameEnginer = null;
var preload;

var Setting = {
    Domain: 'http://localhost:1199/',
    Resoure:'http://localhost:1199/',
    handler: 'http://localhost:1199/API/',
    manifest: [

        { id: 'i1_1', src: 'Resource/images/Room1/1.png' },
        { id: 'i1_2', src: 'Resource/images/Room1/2.png' },
        { id: 'i1_3', src: 'Resource/images/Room1/3.png' },
        { id: 'i1_4', src: 'Resource/images/Room1/4.png' },
        { id: 'i1_5', src: 'Resource/images/Room1/5.png' },
        { id: 'i1_6', src: 'Resource/images/Room1/6.png' },
        { id: 'i1_7', src: 'Resource/images/Room1/7.png' },
        

        { id: 'i2_1', src: 'Resource/images/Room2/1.png' },
        { id: 'i2_2', src: 'Resource/images/Room2/2.png' },
        { id: 'i2_3', src: 'Resource/images/Room2/3.png' },
        { id: 'i2_4', src: 'Resource/images/Room2/4.png' },
        { id: 'i2_5', src: 'Resource/images/Room2/5.png' },
        { id: 'i2_6', src: 'Resource/images/Room2/6.png' },
        { id: 'i2_7', src: 'Resource/images/Room2/7.png' },
        

        { id: 'i3_1', src: 'Resource/images/Room3/1.png' },
        { id: 'i3_2', src: 'Resource/images/Room3/2.png' },
        { id: 'i3_3', src: 'Resource/images/Room3/3.png' },
        { id: 'i3_4', src: 'Resource/images/Room3/4.png' },
        { id: 'i3_5', src: 'Resource/images/Room3/5.png' },
        { id: 'i3_6', src: 'Resource/images/Room3/6.png' },
        { id: 'i3_7', src: 'Resource/images/Room3/7.png' },
        

        { id: 'l1', src: 'Resource/images/Line/Line1.png' },
        { id: 'l2', src: 'Resource/images/Line/Line2.png' },
        { id: 'l3', src: 'Resource/images/Line/Line3.png' },
        { id: 'l4', src: 'Resource/images/Line/Line4.png' },
        { id: 'l5', src: 'Resource/images/Line/Line5.png' },
        { id: 'l6', src: 'Resource/images/Line/Line6.png' },
        { id: 'l7', src: 'Resource/images/Line/Line7.png' },
        { id: 'l8', src: 'Resource/images/Line/Line8.png' },
        { id: 'l9', src: 'Resource/images/Line/Line9.png' },
        { id: 'l10', src: 'Resource/images/Line/Line10.png' },
        { id: 'l11', src: 'Resource/images/Line/Line11.png' },
        { id: 'l12', src: 'Resource/images/Line/Line12.png' },
        { id: 'l13', src: 'Resource/images/Line/Line13.png' },
        { id: 'l14', src: 'Resource/images/Line/Line14.png' },
        { id: 'l15', src: 'Resource/images/Line/Line15.png' },
        { id: 'l16', src: 'Resource/images/Line/Line16.png' },
        { id: 'l17', src: 'Resource/images/Line/Line17.png' },
        { id: 'l18', src: 'Resource/images/Line/Line18.png' },
        { id: 'l19', src: 'Resource/images/Line/Line19.png' },
        { id: 'l20', src: 'Resource/images/Line/Line20.png' },
        
        


        { id: 'font_20', src: 'Resource/images/font_20.png' },
        { id: 'font_24', src: 'Resource/images/font_24.png' },
        { id: 'font_30', src: 'Resource/images/font_30.png' },
 
        { id: 'as1', src: 'Resource/images/as1.png' },
        { id: 'as2', src: 'Resource/images/as2.png' },
        { id: 'as3', src: 'Resource/images/as3.png' },
        { id: 'as4', src: 'Resource/images/as4.png' },
        

        
        { id: 'play1', src: 'Resource/images/play1.png' },
        { id: 'play2', src: 'Resource/images/play2.png' },
        { id: 'play3', src: 'Resource/images/play3.png' },
        { id: 'play4', src: 'Resource/images/play4.png' },
        
        
        { id: 'auto', src: 'Resource/images/auto.png' },
        { id: 'spin', src: 'Resource/images/spin.png' },
        
        { id: 'g2', src: 'Resource/images/gold/2.png' },
        { id: 'g3', src: 'Resource/images/gold/3.png' },
        { id: 'g4', src: 'Resource/images/gold/4.png' },
        { id: 'g5', src: 'Resource/images/gold/5.png' },
        { id: 'g6', src: 'Resource/images/gold/6.png' },
        { id: 'g7', src: 'Resource/images/gold/7.png' },
        { id: 'g8', src: 'Resource/images/gold/8.png' },
        { id: 'g9', src: 'Resource/images/gold/9.png' },
        { id: 'labelText', src: 'Resource/images/labelText.png' },
       { id: 'bggold', src: 'Resource/images/gold/popup.png' }
        
    ],

    Points: [{ x: -5, y: 131 }, { x: -8, y: 31 }, { x: -8, y: 241 }, { x: -8, y: 49 }, { x: -8, y: 101 }, { x: -9, y: 10 }, { x: -9, y: 109 }, { x: -11, y: 16 },
             { x: -7, y: 65 }, { x: -9, y: 39 }, { x: 4, y: 46 }, { x: 10, y: 32 }, { x: 3, y: 37 }, { x: 8, y: 39 }, { x: 4, y: 142 }, { x: 4, y: 3 }, { x: 4, y: 144 },
             { x: 8, y: 36 }, { x: 2, y: 42 }, { x: 4, y: 41 }
    ],
    JackPot: [500000, 5000000, 50000000],

    animIds: [{ name: "panda", Id: 1, x: -48, y: -41 },
              { name: "panda", Id: 2, x: -54, y: 3 },
              { name: "panda", Id: 2, x: -62, y: 49 },
              { name: "panda", Id: 2, x: -67, y: 95 },
              { name: "panda", Id: 2, x: -74, y: 153 }],
    

    animTimes: [{ top: 1, time: 15.4 },
                { top: 2, time: 16.5},
                { top: 3, time: 19.7},
                { top: 4, time: 20.8},
                { top: 5, time: 22 }],
};


function LoadEnginer() {

    preload = new createjs.LoadQueue(true);

    for (var i = 1; i <= 55; i++) {
        Setting.manifest.push({ id: 'coin' + i, src: 'Resource/images/Coin/'+i+'.png' });
    }
    
    preload.loadManifest(Setting.manifest);
   
    preload.onComplete = InitEnginer;
    preload.onProgress = handleOverallProgress;

}

function handleOverallProgress(event) {
    $('#loadding').html(Math.round(event.progress * 100) + "%");
    
}

function InitEnginer() {
    $('#loadding').hide();
    $("#lobbyPlay").show();
    portalEnginer = new PortalEnginer();
    gameEnginer = new GameEnginer();
    
}